package com.ruoyi.merchant.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.merchant.annotation.DictFilter;
import com.ruoyi.merchant.domain.AbilityassessmentReport;
import com.ruoyi.merchant.dto.AbilityassessmentDto;
import com.ruoyi.merchant.dto.AbilityassessmentReportDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.merchant.domain.AbilityassessmentBase;
import com.ruoyi.merchant.service.IAbilityassessmentBaseService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 能力评估-基础信息 Controller
 * 
 * @author chengxin.ju
 * @date 2023-12-24
 */
@RestController
@RequestMapping("/base")
public class AbilityassessmentBaseController extends BaseController
{
    @Autowired
    private IAbilityassessmentBaseService abilityassessmentBaseService;

    /**
     * 查询能力评估-基础信息 列表
     */
    @GetMapping("/list")
    public TableDataInfo list(AbilityassessmentBase abilityassessmentBase)
    {
        startPage();
        List<AbilityassessmentBase> list = abilityassessmentBaseService.selectAbilityassessmentBaseList(abilityassessmentBase);
        return getDataTable(list);
    }


    /**
     * 查询能力评估-基础信息 列表
     */
    @GetMapping("/listAssessment")
    @DictFilter(dataType = "page")
    public TableDataInfo listAssessment(AbilityassessmentDto abilityassessmentDto)
    {
        startPage();
        List<AbilityassessmentBase> list = abilityassessmentBaseService.listAssessment(abilityassessmentDto);
        return getDataTable(list);
    }

    /**
     * 导出能力评估-基础信息 列表
     */
    @RequiresPermissions("system:base:export")
    @Log(title = "能力评估-基础信息 ", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, AbilityassessmentBase abilityassessmentBase)
    {
        List<AbilityassessmentBase> list = abilityassessmentBaseService.selectAbilityassessmentBaseList(abilityassessmentBase);
        ExcelUtil<AbilityassessmentBase> util = new ExcelUtil<AbilityassessmentBase>(AbilityassessmentBase.class);
        util.exportExcel(response, list, "能力评估-基础信息 数据");
    }

    /**
     * 获取能力评估-基础信息 详细信息
     */
    @GetMapping(value = "/getInfo")
    public AjaxResult getInfo(@RequestParam("id") String ID)
    {
        return success(abilityassessmentBaseService.selectAbilityassessmentBaseByID(ID));
    }

    /**
     * 新增能力评估-基础信息 
     */
    @RequiresPermissions("system:base:add")
    @Log(title = "能力评估-基础信息 ", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody AbilityassessmentBase abilityassessmentBase)
    {
        return toAjax(abilityassessmentBaseService.insertAbilityassessmentBase(abilityassessmentBase));
    }

    /**
     * 修改能力评估-基础信息 
     */
    @RequiresPermissions("system:base:edit")
    @Log(title = "能力评估-基础信息 ", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody AbilityassessmentBase abilityassessmentBase)
    {
        return toAjax(abilityassessmentBaseService.updateAbilityassessmentBase(abilityassessmentBase));
    }

    /**
     * 删除能力评估-基础信息 
     */
    @RequiresPermissions("system:base:remove")
    @Log(title = "能力评估-基础信息 ", businessType = BusinessType.DELETE)
	@DeleteMapping("/{IDs}")
    public AjaxResult remove(@PathVariable String[] IDs)
    {
        return toAjax(abilityassessmentBaseService.deleteAbilityassessmentBaseByIDs(IDs));
    }



}
